1. Field of the Invention
The present invention generally relates to a method, system and program product for maintaining data consistency across a hierarchy of caches. Specifically, the present invention allows corresponding data entries in the hierarchy of caches to be linked based on dependency identifiers.
2. Background Art
As use of the world wide web increases, dynamic websites are becoming more pervasive. For example, through various providers such as YAHOO.COM, a computer user can configure a personalized home page (e.g., MY.YAHOO) that will deliver specific web content according to a desired template. Such home pages are generally known as portal pages. Each portal page has one or more portlets into which certain content is arranged. For example, a home page for user “A” could have separate portlets for sports, weather and business. Typically, the portal pages are generated by a portal program such as WebSphere, which is commercially available from International Business Machines Corp. of Armonk, N.Y. When the user requests his/her home page, the desired content is obtained, and arranged into the appropriate portlets by the portal program. In configuring his/her home page, the user can designate, among other things, what type of content (e.g., sports, weather, stocks, etc.) should be received, what data items are contained within the portlets (e.g., what stock ticker symbols to list in the stock portlet), how the portlets are arranged on the home page, how the data items are arranged (e.g., in what order) within the portlets, display options (e.g., colors), etc.
Generating personalized home pages in this manner for a large number of users has traditionally required a large amount of resources. Specifically, each time a user accesses his/her home page, one or more HTTP requests must be processed in order for the home page to be displayed. Such processing not only includes accessing a database or the like to obtain the actual data items, but also generation of the home page according to the user's established template. Accordingly, as the volume of users increases, the quantity of HTTP requests and the amount of processing grows. In many cases, HTTP requests from different users could be requesting the same information. For example, users “A,” “B,” and “C” could all have configured their home pages to include the stock price for “IBM.” When each of these users requests his/her home page, three separate but identical requests (i.e., to obtained the stock price for IBM) would have to be processed.
In an attempt to reduce resource consumption, one or more caches could be provided in the architecture that provide easy access to data and/or tasks already performed. For example, once a requested stock price is initially obtained, it could be stored in a cache so then when requested again (e.g., by another user), a separate database query is not necessary. To this extent, the stock price could be stored in cache until an updated price is provided, at which point the data entry in the cache containing the old stock price is invalidated.
Problems arise, however, when a hierarchy of caches are utilized in this manner. Specifically, in many implementations, a data entry in one cache could depend upon a data entry in another cache. For example, data entry “X” of cache “A” could store the stock price, while data entry “Z” of cache “B” could store a percentage of change from the previous stock price. When an updated stock price is received, both data entry “X” and “Z” should be invalidated. If data entry “X” is updated while data entry “Z” is not, data inconsistency will result. In general, unless two separate invalidation commands are performed, the two data entries must be associated/linked so that invalidation of one causes invalidation of the other. To date, such linking has been a manual process. In particular, an administrator must manually insert code that allows the various data entries to be linked. This is especially time consuming and tedious since the quantity of data entries that must be linked could be exceedingly high.
In view of the foregoing, there exists a need for a method, system and program product for maintaining data consistency across a hierarchy of caches. Specifically, a need exists for each data entry in each cache in the hierarchy to be assigned a unique dependency identifier. A further need exists for a data entry that depends on another data entry to be assigned both its own dependency identifier, as well as the dependency identifier of the data entry on which it depends. Still yet, a need exists for invalidation of a particular data entry based on its dependency identifier to cause automatic invalidation of any other data entries that were assigned its dependency identifier.